Xbasic
CSS::StyleSheet.ToString Method
Syntax
c ToString([C format])
Arguments
- format
Character
- c
Compact attributes.
- n
Normalize attributes (disable compact).
- t
Indent CSS structure with tabs.
Description
Output the CSS style sheet text that represents the style sheet definition.
Example use of 'n' flag
The normalize attributes flag will separate the compact attributes into long form.
dim str as c = <<%str% .myClass { font: Arial 10 pt bold; } %str% dim ss as css::StyleSheet ss.FromString(str) dim str2 as c = ss.ToString("n") showvar(str2) ' Output .myClass { font-family: pt; font-size: 10; font-weight: bold; }
Example use of 'c' flag
The compact attributes flag will combine attributes to thier most compact form.
dim str as c = <<%str% .myClass { font-family: pt; font-size: 10; font-weight: bold; } %str% dim ss as css::StyleSheet ss.FromString(str) dim str2 as c = ss.ToString("c") showvar(str2) ' Output .myClass { font: bold 10 pt; }
Example use of 't' flag
The tabbed indent flag indents the attributes inside a class.
dim str as c = <<%str% .myClass { font-family: pt; font-size: 10; font-weight: bold; } %str% dim ss as css::StyleSheet ss.FromString(str) dim str2 as c = ss.ToString("c") showvar(str2) ' Output .myClass { font-family: pt; font-size: 10; font-weight: bold; }
See Also